<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\EmailSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

?>
<blockquote class="meta">
<h2><?php echo Yii::t('Message','Sent Box') ?></h2>
</blockquote>
 
<div class="email-index">

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            'id',
            'user_id',
            [
                'attribute'=>'title',
                'format'=>'raw',
                'value'=>function ($model, $key, $index, $column){
                    return Html::a($model->title, yii::$app->urlManager->createUrl(['message/viewemail','id'=>$model->id]));
                    },
            ],
 //           'content:ntext',
            'receiver',
            // 'date',

            [
                'class' => 'yii\grid\ActionColumn',
                'template'=>'{delete}',
                'buttons'=>[
                    'delete'=>function($url, $model, $key){
                         return Html::a('Delete', yii::$app->urlManager->createUrl(['message/deleteemail','id'=>$model->id]));
                    },
                ],
            ],
        ],
    ]); ?>

</div>
